/**
 * 
 */
package com.game.model.example;

import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * A simple POJO representing a Person
 * 
 * @author Quake
 */
@Document(collection="Person")
public class Person {
	
	@Id
	private String id;
	@Indexed(unique = true)  
	private Integer ssn;  
	private String firstName;  
	private String lastName;
	private Integer age;
	@Transient//Transient - 短暂的 , 不会被持久化
	private Integer accountTotal;
	
	private Address address;
	
	private Integer dailyCount;
	
	public Person(){
		
	}
	
	@PersistenceConstructor//持久化构造方法，从MongoDB取出时调用
	public Person(Integer ssn, String firstName, String lastName, Integer age, Integer dailyCount) {
		super();
		this.ssn = ssn;
		this.firstName = firstName;
		this.lastName = lastName;
		this.age = age;
		this.dailyCount = dailyCount;
	}


	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Integer getSsn() {
		return ssn;
	}
	public void setSsn(Integer ssn) {
		this.ssn = ssn;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	public Integer getAccountTotal() {
		return accountTotal;
	}
	public void setAccountTotal(Integer accountTotal) {
		this.accountTotal = accountTotal;
	}
	public Address getAddress() {
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	public Integer getDailyCount() {
		return dailyCount;
	}
	public void setDailyCount(Integer dailyCount) {
		this.dailyCount = dailyCount;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Person [id=");
		builder.append(id);
		builder.append(", ssn=");
		builder.append(ssn);
		builder.append(", firstName=");
		builder.append(firstName);
		builder.append(", lastName=");
		builder.append(lastName);
		builder.append(", age=");
		builder.append(age);
		builder.append(", accountTotal=");
		builder.append(accountTotal);
		builder.append(", address=");
		builder.append(address);
		builder.append("]");
		return builder.toString();
	}
	
}
